<template>
  <div class="item-container" style="margin-top:10px">
    <div class="items-wrap">
      <div class="item" @click="clickItem(item.id)" v-for="item in items" :key="item.id">
        <img :src="item.pic" alt="" class="item-img">
        <div class="item-info">
          <h5 class="item-name">
            {{item.name}}
          </h5>
          <p class="item-desc">
            {{ item.characteristic ? item.characteristic : '暂无描述' }}
          </p>
          <div class="item-buy">
            <p class="price">
              ￥{{item.minPrice}}
            </p>
            <van-icon size="20" color="#ff734c" name="gouwuche" class-prefix="icon"></van-icon>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    items: {
      type: Array,
      required: true
    }
  },
  methods: {
    clickItem (id) {
      this.$emit('clickItem', id)
    }
  }
}
</script>

<style lang="scss" scoped>
.item-container{
  .title{
    line-height: 40px;
    font-size: 18px;
    text-align: center;
    color:#333;
  }
  .item{
    display: flex;
    background-color: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    .item-img{
      width: 160px;
    }
    .item-info{
      flex:1;
      padding: 0px 10px;
      .item-name{
        font-size: 16px;
        margin-top: 8px;
        color:#333;
      }
      .item-desc{
        font-size: 14px;
        line-height: 18px;
        margin: 10px 0;
        color:#333;
      }
      .item-buy{
        display: flex;
        justify-content: space-between;
        .price{
          font-size: 20px;
          color:#ff734c;
        }
      }
    }
  }
}
</style>
